package com.ruoyi.client.domain.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * <p>
 * 评论表
 * </p>
 *
 * @author fz
 * @since 2025-02-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("blog_comment")
@Document("comment")
public class BlogComment implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 数据库id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * mongodb id
     */
    @Id
    @TableField(exist = false)
    private ObjectId _id;
    /**
     * 关联id
     */
    private Long relateId;

    /**
     * 创建人
     */
    private Long userId;
    private String userJson;

    /**
     * 文章id
     */
    private Long targetId;
    /**
     * 评论对象json
     */
    private String targetJson;

    /**
     * 父id
     */
    private Long parentId;

    /**
     * 内容
     */
    private String content;

    /**
     * 层级
     */
    private Integer level;

    /**
     * 点赞数
     */
    private Integer likeNum;

    /**
     * 不喜欢数
     */
    private Integer dislikeNum;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;


    /**
     * 跳转的路径
     */
    @TableField(exist = false)
    private String url;
    /**
     * 是否点赞
     */
    @TableField(exist = false)
    private Boolean isLike;
    @TableField(exist = false)
    private Long currentLikeUserId;
    /**
     * 已经点赞用户列表
     */
    @TableField(exist = false)
    private Map<Long,Boolean> likedUserIds;

}
